package com.ruoyi.project.app.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.app.domain.AppLvDriverLocation;
import com.ruoyi.project.app.service.IAppLvDriverLocationService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 司机坐标记录Controller
 * 
 * @author hry
 * @date 2020-10-15
 */
@RestController
@RequestMapping("/system/applvDriverLocation")
public class AppLvDriverLocationController extends BaseController
{
    @Autowired
    private IAppLvDriverLocationService appLvDriverLocationService;

    /**
     * 查询司机坐标记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:applvDriverLocation:list')")
    @GetMapping("/list")
    public TableDataInfo list(AppLvDriverLocation appLvDriverLocation)
    {
        startPage();
        List<AppLvDriverLocation> list = appLvDriverLocationService.selectAppLvDriverLocationList(appLvDriverLocation);
        return getDataTable(list);
    }

    /**
     * 导出司机坐标记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:applvDriverLocation:export')")
    @Log(title = "司机坐标记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(AppLvDriverLocation appLvDriverLocation)
    {
        List<AppLvDriverLocation> list = appLvDriverLocationService.selectAppLvDriverLocationList(appLvDriverLocation);
        ExcelUtil<AppLvDriverLocation> util = new ExcelUtil<AppLvDriverLocation>(AppLvDriverLocation.class);
        return util.exportExcel(list, "applvDriverLocation");
    }

    /**
     * 获取司机坐标记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:applvDriverLocation:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(appLvDriverLocationService.selectAppLvDriverLocationById(id));
    }

    /**
     * 新增司机坐标记录
     */
    @PreAuthorize("@ss.hasPermi('system:applvDriverLocation:add')")
    @Log(title = "司机坐标记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AppLvDriverLocation appLvDriverLocation)
    {
        return toAjax(appLvDriverLocationService.insertAppLvDriverLocation(appLvDriverLocation));
    }

    /**
     * 修改司机坐标记录
     */
    @PreAuthorize("@ss.hasPermi('system:applvDriverLocation:edit')")
    @Log(title = "司机坐标记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AppLvDriverLocation appLvDriverLocation)
    {
        return toAjax(appLvDriverLocationService.updateAppLvDriverLocation(appLvDriverLocation));
    }

    /**
     * 删除司机坐标记录
     */
    @PreAuthorize("@ss.hasPermi('system:applvDriverLocation:remove')")
    @Log(title = "司机坐标记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(appLvDriverLocationService.deleteAppLvDriverLocationByIds(ids));
    }
}
